﻿
Public Class multiple
#Region "Multiple files"
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ' Searches for file extensions txt, rtf and puts them into list

        If browseFolder.ShowDialog() = Windows.Forms.DialogResult.OK Then
            For Each foundFile As String In My.Computer.FileSystem.GetFiles(browseFolder.SelectedPath, FileIO.SearchOption.SearchTopLevelOnly, "*.txt", "*.rtf", "*.xml")
                filesList.Items.Add(foundFile)
            Next
        End If
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles filesList.SelectedIndexChanged
        ' Load contest of file into "Text for translation"

        If filesList.SelectedItem.ToString.EndsWith("rtf") Then
            goti.rtbFrom.LoadFile(filesList.SelectedItem, RichTextBoxStreamType.RichText)
        Else
            goti.rtbFrom.LoadFile(filesList.SelectedItem, RichTextBoxStreamType.PlainText)
        End If
        ' After loading files perform click
        goti.btnTranslate.PerformClick()


    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()
    End Sub
#End Region


End Class
